<template>
  <view class="mutual-assistance">
    <view class="classification-top" style="position: sticky; top: 110rpx">
      <zb-dropdown-menu style="width: 100%">
        <zb-dropdown-item
          name="first"
          :options="option"
          :value="value1"
          @change="change1"
        ></zb-dropdown-item>
        <zb-dropdown-item
          name="two"
          :options="option1"
          :value="value2"
          @change="change1"
        ></zb-dropdown-item>
        <zb-dropdown-item
          name="three"
          :options="option2"
          :value="value2"
          @change="change1"
        ></zb-dropdown-item>
      </zb-dropdown-menu>
    </view>
    <view class="nveiling-box">
      <nveilingCard
        v-for="(item, inedx) in nveilingInf"
		:key="inedx"
        :title="item.title"
        :unveilingText="item.unveilingText"
        :unveilingAddress="item.unveilingAddress"
        :enterpriceUrl="item.enterpriceUrl"
        :enterpriceTitle="item.enterpriceTitle"
        :describeList="item.describeList"
        :showFlag="item.showFlag"
        @getDetailData="getDetail"
        :interestFlag="interestFlag"
      ></nveilingCard>
    </view>
  </view>
</template>

<script setup>
// import comment from "./components/comment.vue"
import nveilingCard from "./componts/nveiling-card.vue";
import { onLoad } from "@dcloudio/uni-app";
import zbDropdownItem from "@/uni_modules/zb-dropdown-menu/components/zb-dropdown-item/zb-dropdown-item.vue";
import zbDropdownMenu from "@/uni_modules/zb-dropdown-menu/components/zb-dropdown-menu/zb-dropdown-menu.vue";
import { getXhBGroupByList } from "@/api/mutual-assistance/index.js";
import { onMounted, ref } from "vue";
const requestType = ref("");
const interestFlag = ref(true);
const value1 = ref(0);
const value2 = ref("a");
const option = ref([
  {
    text: "其他类",
    value: 0,
  },
  {
    text: "综合排序",
    value: 1,
  },
  {
    text: "活动商品",
    value: 2,
  },
]);
const option1 = ref([
  {
    text: "待揭榜的",
    value: "a",
  },
  {
    text: "消费偏好",
    value: "b",
  },
  {
    text: "车辆配置",
    value: "c",
  },
]);
const option2 = ref([
  {
    text: "默认排序",
    value: "a",
  },
  {
    text: "消费偏好",
    value: "b",
  },
  {
    text: "车辆配置",
    value: "c",
  },
]);
// {
// 	showFlag: true,
// 	title: "急需600套PCL线板，价可面议",
// 	unveilingText: "因年前仓库泡水，库存的PCL线板报废，急需600套高程3、线宽12的PCL线板（不挑产地，有上海产则更好），价格可面议",
// 	unveilingAddress: "观山湖区毕节路",
// 	enterpriceUrl: "../../static/image/2024-11-12/1731398767342enterprice.png",
// 	enterpriceTitle: "贵州辛迪加电子科技有限公司",
// 	describeList: ['小微企业', '高新技术', '市级专精特新']

// }
const nveilingInf = ref([]);

function getDetail(data) {}

function change1(data) {
  console.log(data, "........");
}
onMounted(() => {
  console.log("inlai", requestType.value);
  if (requestType.value) {
    getXhBGroupByList({
      requestType: requestType.value,
      size: 20,
      jbStatus: 2,
      page: 5,
    }).then((res) => {
      console.log(res.data, "........");
      let result = res.data.records;
      result.map((o) => {
        nveilingInf.value.push({
          showFlag: o.requestType,
          publishPersonId: o.id,
          title: o.title,
          unveilingText: o.description,
          unveilingAddress: o.location,
          enterpriceUrl: o.avatar,
          imageUrl: o.resourceUrlList[0],
          enterpriceTitle: o.xhbPublishPersonInfoVoList[0].publishName,
          describeList: o.xhbPublishPersonInfoVoList.map((item) => {
            return item.honorName;
          }),
        });
      });
    });
  }
});
onLoad((option) => {
  requestType.value = option.type;
});
</script>

<style lang="less" scoped>
.mutual-assistance {
  .nveiling-box {
    padding-left: 40rpx;
    background-color: #ffffff;
  }

  .classification-top {
    margin: 20rpx 0 0 0;

    .filter-wrappe {
      .uni-page-body {
        color: #272636;
      }
    }
  }
}
</style>
